#pragma once

#include "DX11Includes.h"
#include <vector>

#include <assimp.hpp>      // C++ importer interface
#include <aiScene.h>       // Output data structure
#include <aiPostProcess.h> // Post processing flags
#include "AlignedMemoryBase.h"
#include <map>
#include <string>

class SceneAnimNode : public AlignedMemoryBase
{
public:	

	int index;

	std::string mName;
	int mParent;
	std::vector<int> mChildren;

	std::map<int,int> animationChannelIndex;

	//! most recently calculated local transform
	XMMATRIX mLocalTransform; 

	//! same, but in world space
	XMMATRIX mGlobalTransform;
	
	//! Default construction
	SceneAnimNode() {
		 mParent = NULL; 
	}

	//! Construction from a given name
	SceneAnimNode( const std::string& pName) 
		: mName( pName) { 
			mParent = NULL;
	}

	//! Destruct all children recursively
	~SceneAnimNode() {
		
	}		
	
	SceneAnimNode* Clone()
	{
		SceneAnimNode* current = new(16) SceneAnimNode;
		current->animationChannelIndex = animationChannelIndex ;
		current->mName = mName;
		current->index = index;
		current->mParent = mParent;
		current->mGlobalTransform = mGlobalTransform;
		current->mLocalTransform = mLocalTransform;

		for(int i = 0; i < mChildren.size() ; i++)
		{			
			current->mChildren.push_back(mChildren[i]);
		}

		return current;
	}
};


enum MeshTypeData
{
	PositionTextureNormal , PositionTextureNormalTangentBinormal , PositionTexture, PositionTextureNormalTangentBinormalAnimated ,NONE
};

struct PositionTextureNormalVertex
{
    XMFLOAT3 Position;
    XMFLOAT2 Texture;
	XMFLOAT3 Normal;
};

struct PositionTextureNormalTangentBinormalAnimatedVertex
{
    XMFLOAT3 Position;
    XMFLOAT2 Texture;
	XMFLOAT3 Normal;
	XMFLOAT3 Tangent;
	XMFLOAT3 Binormal;
	XMFLOAT4 Weights;
	XMFLOAT4 Indexes;
};

struct PositionTextureNormalTangentBinormalVertex
{
    XMFLOAT3 Position;
    XMFLOAT2 Texture;
	XMFLOAT3 Normal;
	XMFLOAT3 Tangent;
	XMFLOAT3 Binormal;
};

union VertexData
{
	PositionTextureNormalTangentBinormalVertex *positionTextureNormalTangentBinormalVertex;
	PositionTextureNormalVertex  *positionTextureNormalVertex  ;
	PositionTextureNormalTangentBinormalAnimatedVertex *positionTextureNormalTangentBinormalAnimatedVertex;

};

enum TextureTypes
{
	Diffuse,NormalMap
};

struct PositionTextureVertex
{
	XMFLOAT3 Position;
	XMFLOAT2 Texture;
};